package Controler.Professeur;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import Controller.BDD.GestionGroupeBDD;
import JDBC.Professeur_Afficher;
import Model.Cours;
import Model.Groupe;
import Model.Listes;
import Model.Professeur;

/**
 * Servlet implementation class Professeur_ChargerController
 */
@WebServlet("/Professeur_ChargerController")
public class Professeur_ChargerController extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Professeur_ChargerController() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		HttpSession session = request.getSession();
		Listes listes = (Listes) session.getAttribute("listes");
		
		if (listes==null)
		{
			listes = new Listes();
		}
		
		Professeur_Afficher listeProf = new Professeur_Afficher();
		ArrayList<Professeur> mesProfesseurs = listeProf.afficher();
		listes.setMesProfesseurs(mesProfesseurs);
		System.out.println(listes.getMesProfesseurs().size());
		session.setAttribute("listes", listes);
		request.getRequestDispatcher("Vues/Professeur/vueGRP1_tableauProf.jsp").forward(request, response);

		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
